home *** CD-ROM | disk | FTP | other *** search
/ Compute! Gazette 1984 June / 1984-06.d64 / begin corner_vic (.txt) < prev    next >
Commodore BASIC  |  2022-09-20  |  3KB  |  98 lines

  1. 1 goto28
  2. 2 pokem,77:pokem+3,78:pokem+23,77:pokem+24,78:pokem+45,78
  3. 3 pokem+46,77:pokem+66,78:pokem+69,77:return
  4. 4 pokem,85:pokem+1,67:pokem+2,67:pokem+3,73:pokem+22,66:pokem+23,32:pokem+25,93
  5. 5 pokem+44,66:pokem+47,93:pokem+66,74:pokem+67,64:pokem+68,64:pokem+69,75:return
  6. 6 fori=m+c tom+c+66 step22:pokei,cc(n):pokei+1,cc(n):pokei+2,cc(n)
  7. 7 pokei+3,cc(n):next:return
  8. 8 pokef1,231
  9. 9 ford=1to60:next:pokef1,0:return
  10. 10 x=n:p(e)=x:m=s(e):onx gosub2,2,4
  11. 11 gosub6
  12. 12 fori=1to7step3
  13. 13 ifp(i)<>p(i+1)then16
  14. 14 ifp(i)<>p(i+2)then16
  15. 15 onp(i)+1goto16,89,89,89
  16. 16 next
  17. 17 fori=1to3
  18. 18 ifp(i)<>p(i+3)then21
  19. 19 ifp(i)<>p(i+6)then21
  20. 20 onp(i)+1goto21,89,89,89
  21. 21 next
  22. 22 ifp(5)<>x then25
  23. 23 if(p(1)=x)and(p(9)=x)then89
  24. 24 if(p(3)=x)and(p(7)=x)then89
  25. 25 fori=1to9:ifp(i)=0then27
  26. 26 next:print"tie game!":goto92
  27. 27 n=abs(n-4):return
  28. 28 print"[147]":printtab(5)"tic-tac-toe":fori=1to9:reads(i):next
  29. 29 data7726,7733,7740,7880,7887,7894,8034,8041,8048
  30. 30 print"choose one of the":print"position numbers.":print"get 3 in a row."
  31. 31 poke36878,15:f1=36876:c=30720:cc(1)=6:cc(3)=2:y=3:z=1:h=2
  32. 32 print"[144]x gets first move.":print"choose [144]f1 for [144]x":printtab(7)"f3 for [144]0"
  33. 33 gete$:ife$<>"[133]"ande$<>"[134]"then33
  34. 34 ife$="[133]"theny=1:z=3
  35. 35 print"choose [144]f1 beginner":printtab(7)"[144]f3 intermediate"
  36. 36 gete$:ife$<>"[133]"ande$<>"[134]"then36
  37. 37 ife$="[133]"thenh=1
  38. 38 print"[147]":t=int(6*rnd(0))+2:fori=1to9:p(i)=0:next
  39. 39 fori=7709to8129step22:pokei,160:pokei+c,t:pokei+7,160:pokei+7+c,t:next
  40. 40 fori=7835to7854:pokei,160:pokei+c,t:pokei+154,160:pokei+154+c,t:next
  41. 41 fori=1to9:pokes(i)+23,i+48:pokes(i)+23+c,0:next
  42. 42 n=1:ifh=2then51
  43. 43 ify=1then46
  44. 44 e=int(9*rnd(0)+1):ifp(e)<>0then44
  45. 45 gosub10
  46. 46 gosub8
  47. 47 gete$:ife$=""then47
  48. 48 ife$<"1"ore$>"9"then47
  49. 49 e=val(e$):ifp(e)<>0then46
  50. 50 gosub10:onh goto44,52
  51. 51 ify=1then46
  52. 52 ifp(5)=0thene=5:goto88
  53. 53 ifp(5)=x then58
  54. 54 ifp(1)=0andp(9)=z thene=1:goto88
  55. 55 ifp(1)=z andp(9)=0thene=9:goto88
  56. 56 ifp(3)=0andp(7)=z thene=3:goto88
  57. 57 ifp(3)=z andp(7)=0thene=7:goto88
  58. 58 fork=1to3:if(p(k)=x)+(p(k+3)=x)+(p(k+6)=x)then63
  59. 59 ifp(k)+p(k+3)+p(k+6)<>2*z then63
  60. 60 if p(k)=0thene=k:goto88
  61. 61 ifp(k+3)=0thene=k+3:goto88
  62. 62 e=k+6:goto88
  63. 63 next
  64. 64 fork=1to7step3:if(p(k)=x)+(p(k+1)=x)+(p(k+2)=x)then69
  65. 65 ifp(k)+p(k+1)+p(k+2)<>2*z then69
  66. 66 ifp(k)=0thene=k:goto88
  67. 67 ifp(k+1)=0thene=k+1:goto88
  68. 68 e=k+2:goto88
  69. 69 next
  70. 70 fork=1to3:if(p(k)=z)+(p(k+3)=z)+(p(k+6)=z)then75
  71. 71 ifp(k)+p(k+3)+p(k+6)<>2*x then75
  72. 72 ifp(k)=0thene=k:goto88
  73. 73 ifp(k+3)=0thene=k+3:goto88
  74. 74 e=k+6:goto88
  75. 75 next
  76. 76 fork=1to7step3:if(p(k)=z)+(p(k+1)=z)+(p(k+2)=z)then81
  77. 77 ifp(k)+p(k+1)+p(k+2)<>2*x then81
  78. 78 ifp(k)=0then e=k:goto88
  79. 79 ifp(k+1)=0thene=k+1:goto88
  80. 80 e=k+2:goto88
  81. 81 next
  82. 82 ifp(5)=z then87
  83. 83 ifp(1)=0andp(9)=x thene=1:goto88
  84. 84 ifp(1)=x andp(9)=0thene=9:goto88
  85. 85 ifp(3)=0andp(7)=x thene=3:goto88
  86. 86 ifp(3)=x andp(7)=0thene=7:goto88
  87. 87 goto44
  88. 88 gosub10:goto46
  89. 89 ifx<>y then91
  90. 90 print"you win!!!":goto92
  91. 91 print"computer wins!!"
  92. 92 fori=1to20:pokef1,int(20*rnd(0)+200):gosub9:next
  93. 93 print"try again? (y/n)";
  94. 94 gete$:ife$="n"then97
  95. 95 ife$<>"y"then94
  96. 96 clr:goto28
  97. 97 print"[147]":end
  98.